<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>

	<body>
		<div id="app">
			<h2>{{fullName}}</h2>
		</div>

		<script src="../lib/vue.js"></script>
		<script>
			let vm = new Vue({
				el: "#app",
				data: {
					firstName: "Kobe",
					lastName: "Bryant"
				},
				computed: {
					//计算属性一般是没有set方法，只读属性
					fullName: {
						// set(newValue) {
						// 	const names = newValue.split(" ");
						// 	this.firstName = names[0];
						// 	this.lastName = names[1];
						// },
						get() {
							return this.firstName + " " + this.lastName;
						}
					}
					// fullName(){
					//   return this.firstName + " " + this.lastName;
					// }
				},
				methods: {}
			});
		</script>
	</body>
</html>
